/*回顾：
定义一个字符串数组，输入一个字符串,从数组中删除,删除后,后面的往前移动,注意置空的处理...
比如字符串为{"aa","bb","cc","ff"},如果bb被删除后,则为{"aa","cc","ff",null}*/

package Work0508;

import java.util.Scanner;

public class ZiFuChuan {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String[] arr = { "aa", "bb", "cc", "dd", "ee", "ff", "gg", "hh" };
		System.out.println(arr.length);
		System.out.print("请输入数组中要删除的字符串：");
		String symbol = in.next();
		Loop: for (int a = 0; a < arr.length; a++) {
			if (arr[a].equals(symbol)) {
				for (int b = a; b < arr.length - 1; b++) {
					arr[b] = arr[b + 1];
					if ((b + 2) == arr.length) {
						arr[b + 1] = null;
						for (int c = 0; c < arr.length; c++) {
							System.out.println(arr[c]);
							if (c + 1 == arr.length) {
								break Loop;
							}
						}

					}
				}
			}
		}

	}

}
